<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.2">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"wrr123.github.io","root":"/","scheme":"Muse","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.json"};
  </script>

  <meta name="description" content="talk is cheap, show me the code">
<meta property="og:type" content="website">
<meta property="og:title" content="一缕烟气">
<meta property="og:url" content="https://wrr123.github.io/page/33/index.html">
<meta property="og:site_name" content="一缕烟气">
<meta property="og:description" content="talk is cheap, show me the code">
<meta property="og:locale" content="zh_CN">
<meta property="article:author" content="田园隐士">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="https://wrr123.github.io/page/33/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : true,
    isPost : false,
    lang   : 'zh-CN'
  };
</script>

  <title>一缕烟气</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

<link rel="alternate" href="/atom.xml" title="一缕烟气" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">一缕烟气</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">沧海月明珠有泪，蓝田日暖玉生烟</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content index posts-expand">
            
      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://wrr123.github.io/2020/07/09/window-location-href%E5%92%8Cwindow-open%E7%9A%84%E5%87%A0%E7%A7%8D%E7%94%A8%E6%B3%95%E5%92%8C%E5%8C%BA%E5%88%AB/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="田园隐士">
      <meta itemprop="description" content="talk is cheap, show me the code">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="一缕烟气">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2020/07/09/window-location-href%E5%92%8Cwindow-open%E7%9A%84%E5%87%A0%E7%A7%8D%E7%94%A8%E6%B3%95%E5%92%8C%E5%8C%BA%E5%88%AB/" class="post-title-link" itemprop="url">window.location.href和window.open的几种用法和区别</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2020-07-09 13:16:36" itemprop="dateCreated datePublished" datetime="2020-07-09T13:16:36+08:00">2020-07-09</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2022-02-18 10:52:04" itemprop="dateModified" datetime="2022-02-18T10:52:04+08:00">2022-02-18</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E5%89%8D%E7%AB%AF/" itemprop="url" rel="index"><span itemprop="name">前端</span></a>
                </span>
            </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>2.2k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>2 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h4 id="Window-Location"><a href="#Window-Location" class="headerlink" title="Window Location"></a>Window Location</h4><p>window.location对象在编写时，可以不使用window这个前缀。</p>
<p>一些例子：</p>
<ul>
<li>location.hostname 返回web主机的域名</li>
<li>location.pathname 返回当前页面的路径和文件名</li>
<li>location.port 返回web主机的端口</li>
<li>location.protocal 返回所使用的web协议(如http，https)</li>
</ul>
<h4 id="Window-Location-Href"><a href="#Window-Location-Href" class="headerlink" title="Window Location Href"></a>Window Location Href</h4><p>该属性返回当前页面的URL</p>
<h4 id="Window-Location-Pathname"><a href="#Window-Location-Pathname" class="headerlink" title="Window Location Pathname"></a>Window Location Pathname</h4><p>该属性返回URL的路径名</p>
<h4 id="Window-Location-Assign"><a href="#Window-Location-Assign" class="headerlink" title="Window Location Assign"></a>Window Location Assign</h4><p><code>location.assign()</code>该方法加载新的文档</p>
<h4 id="location-href常见的几种形式"><a href="#location-href常见的几种形式" class="headerlink" title="location.href常见的几种形式"></a>location.href常见的几种形式</h4><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">self.<span class="property">location</span>.<span class="property">href</span>;<span class="comment">//当前页面打开URL页面</span></span><br><span class="line"><span class="variable language_">window</span>.<span class="property">location</span>.<span class="property">href</span>;<span class="comment">//当前页面打开URL页面</span></span><br><span class="line"><span class="variable language_">this</span>.<span class="property">location</span>.<span class="property">href</span>;<span class="comment">//当前页面打开URL页面</span></span><br><span class="line">location.<span class="property">href</span>;<span class="comment">// 当前页面打开URL页面</span></span><br><span class="line">parent.<span class="property">location</span>.<span class="property">href</span>;<span class="comment">//在父页面打开新页面</span></span><br><span class="line">top.<span class="property">location</span>.<span class="property">href</span>;<span class="comment">//在顶层页面打开新页面   </span></span><br></pre></td></tr></table></figure>
<blockquote>
<p>注：①如果页面中自定义了frame，那么可将parent、self、top换为自定义frame的名称,效果是在frame窗口打开url地址。</p>
<p>②此外，window.location.href=window.location.href;和window.location.Reload();都是刷新当前页面。区别在于是否有提交数据。当有提交数据时，window.location.Reload()会提示是否提交，window.location.href=window.location.href;则是向指定的url提交数据.</p>
<p>③用window.open()打开新页面<br>但是用window.location.href＝”” 却是在原窗口打开的.<br>有时浏览器会一些安全设置window.open肯定被屏蔽。例如避免弹出广告窗口。</p>
</blockquote>
<h4 id="window-location-href和window-open-之间的区别"><a href="#window-location-href和window-open-之间的区别" class="headerlink" title="window.location.href和window.open()之间的区别"></a>window.location.href和window.open()之间的区别</h4><ol>
<li><p>```text<br>window.location是window对象的属性，而window.open是window对象的方法<br>  window.location是你对当前浏览器窗口的URL地址对象的参考！<br>  window.open是用来打开一个新窗口的函数！ </p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">2. ```text</span><br><span class="line">   window.open不一定是打开一个新窗口!!!!!!!!   </span><br><span class="line">     只要有窗口的名称和window.open中第二个参数中的一样就会将这个窗口替换，用这个特性的话可以在iframe和frame中来代替location.href。 </span><br><span class="line">   如&lt;iframe name=&quot;aa&quot;&gt;&lt;/iframe&gt;   </span><br><span class="line">     &lt;input type=button   onclick=&quot;window.open(&#x27;1.htm&#x27;,&#x27;aa&#x27;,&#x27;&#x27;)&quot;&gt;和   </span><br><span class="line">     &lt;input type=button   </span><br><span class="line">      onclick=&quot;self.frames[&#x27;aa&#x27;].location.href=&#x27;1.htm&#x27;&quot;&gt;的效果一样 </span><br></pre></td></tr></table></figure>
</li>
<li><p>```text<br>在给按钮、表格、单元格、下拉列表和DIV等做链接时一般都要用Javascript来完成，和做普通链接一样，可能我们需要让链接页面在当前窗口打开，也可能需要在新窗口打开，这时我们就可以使用下面两项之一来完成： </p>
<pre><code>window.open 用来打开新窗口 
window.location 用来替换当前页，也就是重新定位当前页 
可以用以下来个实例来测试一下。 
</code></pre><p><input type="button" value="新窗口打开" onclick="window.open('http://www.google.com')"><br><input type="button" value="当前页打开" onclick="window.location='http://www.google.com/'"> </p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">4. ```text</span><br><span class="line">   window.location或window.open如何指定target? </span><br><span class="line">   这是一个经常遇到的问题，特别是在用frame框架的时候 </span><br><span class="line">   解决办法: </span><br><span class="line">   window.location 改为 top.location　即可在顶部链接到指定页 </span><br><span class="line">   或 </span><br><span class="line">   window.open(&quot;你的网址&quot;,&quot;_top&quot;); </span><br></pre></td></tr></table></figure>
</li>
<li><p>```text<br>window.open 用来打开新窗口<br>window.location 用来替换当前页，也就是重新定位当前页 </p>
<p>用户不能改变document.location(因为这是当前显示文档的位置)。<br>window.location本身也是一个对象。 </p>
<p>   但是,可以用window.location改变当前文档 (用其它文档取代当前文档),而document.location不是对象。<br>   服务器重定向后有可能使document.url变动,但window.location.href指的永远是访问该网页时用的URL.<br>   大多数情况下,document.location和location.href是相同的，但是，当存在服务器重定向时，document.location包含的是已经装载的URL，而location.href包含的则是原始请求的文档的URL.</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">6. ```text</span><br><span class="line">   window.open()是可以在一个网站上打开另外的一个网站的地址 </span><br><span class="line">   而window.location()是只能在一个网站中打开本网站的网页 </span><br></pre></td></tr></table></figure>
</li>
</ol>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://wrr123.github.io/2020/07/08/%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90%E5%85%A5%E9%97%A8/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="田园隐士">
      <meta itemprop="description" content="talk is cheap, show me the code">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="一缕烟气">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2020/07/08/%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90%E5%85%A5%E9%97%A8/" class="post-title-link" itemprop="url">持续集成入门</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2020-07-08 16:24:49" itemprop="dateCreated datePublished" datetime="2020-07-08T16:24:49+08:00">2020-07-08</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2022-02-18 10:52:04" itemprop="dateModified" datetime="2022-02-18T10:52:04+08:00">2022-02-18</time>
              </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>1.6k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>1 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <p>互联网软件的开发和发布，已经形成了一套标准流程，最重要的组成部分就是持续集成（Continuous integration，简称CI）。</p>
<p>本文简要介绍持续集成的概念和做法。</p>
<p><img src="http://www.ruanyifeng.com/blogimg/asset/2015/bg2015092301.png" alt="img"></p>
<h2 id="一、概念"><a href="#一、概念" class="headerlink" title="一、概念"></a>一、概念</h2><p><strong>持续集成指的是，频繁地（一天多次）将代码集成到主干。</strong></p>
<p>它的好处主要有两个。</p>
<blockquote>
<p><strong>（1）快速发现错误。</strong>每完成一点更新，就集成到主干，可以快速发现错误，定位错误也比较容易。</p>
<p><strong>（2）防止分支大幅偏离主干。</strong>如果不是经常集成，主干又在不断更新，会导致以后集成的难度变大，甚至难以集成。</p>
</blockquote>
<p><strong>持续集成的目的，就是让产品可以快速迭代，同时还能保持高质量。</strong>它的核心措施是，代码集成到主干之前，必须通过自动化测试。只要有一个测试用例失败，就不能集成。</p>
<p>Martin Fowler说过，”持续集成并不能消除Bug，而是让它们非常容易发现和改正。”</p>
<p>与持续集成相关的，还有两个概念，分别是持续交付和持续部署。</p>
<h2 id="二、持续交付"><a href="#二、持续交付" class="headerlink" title="二、持续交付"></a>二、持续交付</h2><p><strong>持续交付（Continuous delivery）指的是，频繁地将软件的新版本，交付给质量团队或者用户，以供评审。</strong>如果评审通过，代码就进入生产阶段。</p>
<p>持续交付可以看作持续集成的下一步。它强调的是，不管怎么更新，软件是随时随地可以交付的。</p>
<h2 id="三、持续部署"><a href="#三、持续部署" class="headerlink" title="三、持续部署"></a>三、持续部署</h2><p><strong>持续部署（continuous deployment）是持续交付的下一步，指的是代码通过评审以后，自动部署到生产环境。</strong></p>
<p>持续部署的目标是，代码在任何时刻都是可部署的，可以进入生产阶段。</p>
<p>持续部署的前提是能自动化完成测试、构建、部署等步骤。它与持续交付的区别，可以参考下图。</p>
<p><img src="http://www.ruanyifeng.com/blogimg/asset/2015/bg2015092302.jpg" alt="img"></p>
<p>（<a target="_blank" rel="noopener" href="http://blog.crisp.se/2013/02/05/yassalsundman/continuous-delivery-vs-continuous-deployment">图片来源</a>）</p>
<h2 id="四、流程"><a href="#四、流程" class="headerlink" title="四、流程"></a>四、流程</h2><p>根据持续集成的设计，代码从提交到生产，整个过程有以下几步。</p>
<h3 id="4-1-提交"><a href="#4-1-提交" class="headerlink" title="4.1 提交"></a>4.1 提交</h3><p>流程的第一步，是开发者向代码仓库提交代码。所有后面的步骤都始于本地代码的一次提交（commit）。</p>
<h3 id="4-2-测试（第一轮）"><a href="#4-2-测试（第一轮）" class="headerlink" title="4.2 测试（第一轮）"></a>4.2 测试（第一轮）</h3><p>代码仓库对commit操作配置了钩子（hook），只要提交代码或者合并进主干，就会跑自动化测试。</p>
<p>测试有好几种。</p>
<blockquote>
<ul>
<li>单元测试：针对函数或模块的测试</li>
<li>集成测试：针对整体产品的某个功能的测试，又称功能测试</li>
<li>端对端测试：从用户界面直达数据库的全链路测试</li>
</ul>
</blockquote>
<p>第一轮至少要跑单元测试。</p>
<h3 id="4-3-构建"><a href="#4-3-构建" class="headerlink" title="4.3 构建"></a>4.3 构建</h3><p>通过第一轮测试，代码就可以合并进主干，就算可以交付了。</p>
<p>交付后，就先进行构建（build），再进入第二轮测试。所谓构建，指的是将源码转换为可以运行的实际代码，比如安装依赖，配置各种资源（样式表、JS脚本、图片）等等。</p>
<p>常用的构建工具如下。</p>
<blockquote>
<ul>
<li><a target="_blank" rel="noopener" href="http://jenkins-ci.org/">Jenkins</a></li>
<li><a target="_blank" rel="noopener" href="https://travis-ci.com/">Travis</a></li>
<li><a target="_blank" rel="noopener" href="https://www.codeship.io/">Codeship</a></li>
<li><a target="_blank" rel="noopener" href="http://stridercd.com/">Strider</a></li>
</ul>
</blockquote>
<p>Jenkins和Strider是开源软件，Travis和Codeship对于开源项目可以免费使用。它们都会将构建和测试，在一次运行中执行完成。</p>
<h3 id="4-4-测试（第二轮）"><a href="#4-4-测试（第二轮）" class="headerlink" title="4.4 测试（第二轮）"></a>4.4 测试（第二轮）</h3><p>构建完成，就要进行第二轮测试。如果第一轮已经涵盖了所有测试内容，第二轮可以省略，当然，这时构建步骤也要移到第一轮测试前面。</p>
<p>第二轮是全面测试，单元测试和集成测试都会跑，有条件的话，也要做端对端测试。所有测试以自动化为主，少数无法自动化的测试用例，就要人工跑。</p>
<p>需要强调的是，新版本的每一个更新点都必须测试到。如果测试的覆盖率不高，进入后面的部署阶段后，很可能会出现严重的问题。</p>
<h3 id="4-5-部署"><a href="#4-5-部署" class="headerlink" title="4.5 部署"></a>4.5 部署</h3><p>通过了第二轮测试，当前代码就是一个可以直接部署的版本（artifact）。将这个版本的所有文件打包（ <code>tar filename.tar *</code> ）存档，发到生产服务器。</p>
<p>生产服务器将打包文件，解包成本地的一个目录，再将运行路径的符号链接（symlink）指向这个目录，然后重新启动应用。这方面的部署工具有<a target="_blank" rel="noopener" href="http://www.ansible.com/">Ansible</a>，<a target="_blank" rel="noopener" href="https://www.chef.io/chef/">Chef</a>，<a target="_blank" rel="noopener" href="https://puppetlabs.com/">Puppet</a>等。</p>
<h3 id="4-6-回滚"><a href="#4-6-回滚" class="headerlink" title="4.6 回滚"></a>4.6 回滚</h3><p>一旦当前版本发生问题，就要回滚到上一个版本的构建结果。最简单的做法就是修改一下符号链接，指向上一个版本的目录。</p>
<h2 id="五、参考链接"><a href="#五、参考链接" class="headerlink" title="五、参考链接"></a>五、参考链接</h2><ul>
<li>Gergely Nemeth, <a target="_blank" rel="noopener" href="https://blog.risingstack.com/continuous-deployment-of-node-js-applications/">Continuous Deployment of Node.js Applications</a></li>
<li>Codeship, <a target="_blank" rel="noopener" href="https://codeship.com/continuous-integration-essentials">Continuous Integration Essentials</a></li>
</ul>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://wrr123.github.io/2020/07/08/Pull-Request%E5%91%BD%E4%BB%A4%E8%A1%8C%E6%95%B4%E7%90%86/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="田园隐士">
      <meta itemprop="description" content="talk is cheap, show me the code">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="一缕烟气">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2020/07/08/Pull-Request%E5%91%BD%E4%BB%A4%E8%A1%8C%E6%95%B4%E7%90%86/" class="post-title-link" itemprop="url">Pull Request命令行整理</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2020-07-08 16:04:45" itemprop="dateCreated datePublished" datetime="2020-07-08T16:04:45+08:00">2020-07-08</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2022-02-18 10:52:04" itemprop="dateModified" datetime="2022-02-18T10:52:04+08:00">2022-02-18</time>
              </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>1.4k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>1 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h4 id="定义"><a href="#定义" class="headerlink" title="定义"></a>定义</h4><p>官方定义</p>
<figure class="highlight text"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">&quot;Pull Request 是一种通知机制。你修改了他人的代码，将你的修改通知原来的作者，希望他合并你的修改，这就是 Pull Request。&quot;</span><br></pre></td></tr></table></figure>
<p>Pull Request本质上是一种软件的合作方式，是将涉及不同功能的代码，纳入主干代码的流程。在这个过程中，还可以进行讨论、审核和修改代码。</p>
<h2 id="Pull-Request-的流程"><a href="#Pull-Request-的流程" class="headerlink" title="Pull Request 的流程"></a>Pull Request 的流程</h2><p>第一步，你需要把别人的代码，克隆到你自己的仓库，Github 的术语叫做 <a target="_blank" rel="noopener" href="https://help.github.com/articles/fork-a-repo/">fork</a>。</p>
<p>第二步，在你仓库的修改后的分支上，按下”New pull request”按钮。</p>
<p><img src="http://www.ruanyifeng.com/blogimg/asset/2017/bg2017071802.png" alt="img"></p>
<p>这时，会进入一个新页面，有Base 和 Head 两个选项。Base 是你希望提交变更的目标，Head 是目前包含你的变更的那个分支或仓库。</p>
<p><img src="http://www.ruanyifeng.com/blogimg/asset/2017/bg2017071806.png" alt="img"></p>
<p>第三步，填写说明，帮助别人理解你的提交，然后按下”create pull request”按钮即可。</p>
<p><img src="http://www.ruanyifeng.com/blogimg/asset/2017/bg2017071805.png" alt="img"></p>
<p>PR 创建后，管理者就要决定是否接受该 PR。对于非代码变更（比如文档），单单使用 Web 界面就足够了。但是，对于代码变更，Web 界面可能不够用，需要命令行验证是否可以运行。</p>
<h2 id="git-am"><a href="#git-am" class="headerlink" title="git am"></a>git am</h2><p><code>git am</code>命令用于将一个 patch 文件，合并进入当前代码。</p>
<p>Github 对每个 PR 会自动生成一个 patch 文件。我们下载该文件，合并进本地代码，就可以在本地查看效果了。</p>
<blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ curl -L http://github.com/cbeust/testng/pull/17.patch | git am</span><br></pre></td></tr></table></figure>
</blockquote>
<p>上面代码中，<code>curl</code>的<code>-L</code>参数表示，如果有302跳转，<code>curl</code>会自动跟进。后面网址里面的<code>/cbeust/testng</code>是目标仓库，<code>pull/17</code>表示该仓库收到的第17个 PR。</p>
<p>如果 PR 只包含一个 commit，那么也可以直接下载这个 commit 的 patch 文件。</p>
<blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ curl https://github.com/sclasen/jcommander/commit/bd770141029f49bcfa2e0d6e6e6282b531e69179.patch | git am</span><br></pre></td></tr></table></figure>
</blockquote>
<p>上面代码中，网址里面的<code>/sclasen/jcommander</code>是代码变更所在的那个仓库。</p>
<h2 id="创建远程仓库"><a href="#创建远程仓库" class="headerlink" title="创建远程仓库"></a>创建远程仓库</h2><p>另一种方法是为 PR 创建一个远程分支，追踪提交者的仓库。</p>
<blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 创建远程仓库，指向 PR 提交者的仓库</span></span><br><span class="line">$ git remote add nullin git://github.com/nullin/testng.git</span><br><span class="line"></span><br><span class="line"><span class="comment"># 从该远程仓库拉取代码</span></span><br><span class="line">$ git fetch nullin</span><br><span class="line"></span><br><span class="line"><span class="comment"># 将该仓库的某个分支合并到当前分支</span></span><br><span class="line">$ git merge kneath/error-page</span><br><span class="line"></span><br><span class="line"><span class="comment"># 推送到自己的仓库</span></span><br><span class="line">$ git push origin master</span><br></pre></td></tr></table></figure>
</blockquote>
<h2 id="cherry-pick"><a href="#cherry-pick" class="headerlink" title="cherry-pick"></a>cherry-pick</h2><p>有时，PR 里面包含好几个 commit，但是你只想合并其中的一个或几个。</p>
<p>这时可以使用<code>cherry-pick</code>命令，挑出你感兴趣的 commit。</p>
<blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 建立远程分支，追踪提交者的仓库</span></span><br><span class="line">$ git remote add nullin git://github.com/nullin/testng.git</span><br><span class="line"></span><br><span class="line"><span class="comment"># 从该远程仓库拉取代码</span></span><br><span class="line">$ git fetch nullin</span><br><span class="line"></span><br><span class="line"><span class="comment"># 只将感兴趣的 commit 加入当前代码</span></span><br><span class="line">$ git cherry-pick commit1</span><br><span class="line">$ git cherry-pick commit2</span><br><span class="line"></span><br><span class="line"><span class="comment"># 推送到自己的仓库</span></span><br><span class="line">$ git push origin master</span><br></pre></td></tr></table></figure>
</blockquote>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://wrr123.github.io/2020/07/08/%E6%95%8F%E6%8D%B7%E5%BC%80%E5%8F%91%E5%85%A5%E9%97%A8/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="田园隐士">
      <meta itemprop="description" content="talk is cheap, show me the code">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="一缕烟气">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2020/07/08/%E6%95%8F%E6%8D%B7%E5%BC%80%E5%8F%91%E5%85%A5%E9%97%A8/" class="post-title-link" itemprop="url">敏捷开发入门</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2020-07-08 15:05:13" itemprop="dateCreated datePublished" datetime="2020-07-08T15:05:13+08:00">2020-07-08</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2022-02-18 10:52:04" itemprop="dateModified" datetime="2022-02-18T10:52:04+08:00">2022-02-18</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/java/" itemprop="url" rel="index"><span itemprop="name">java</span></a>
                </span>
            </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>2.2k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>2 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <p>敏捷开发（agile development）是非常流行的软件开发方法。据<a target="_blank" rel="noopener" href="https://www.statista.com/statistics/673786/worldwide-software-development-survey-agile-development-continuous-integration-adoption/">统计</a>，2018年90%的软件开发采用敏捷开发。</p>
<p>但是，到底什么是敏捷开发，能说清的人却不多。本文尝试用简洁易懂的语言，解释敏捷开发。</p>
<h4 id="迭代开发"><a href="#迭代开发" class="headerlink" title="迭代开发"></a>迭代开发</h4><p><strong>敏捷开发的核心是迭代开发（iterative development）。敏捷一定是采用迭代开发的方式。</strong></p>
<p>那么什么是”迭代开发”呢？迭代的英文是 iterative，直译为”重复”，迭代开发其实就是”重复开发”。</p>
<p>对于大型软件项目，传统的开发方式是采用一个大周期（比如一年）进行开发，整个过程就是一次”大开发”；迭代开发的方式则不一样，它将开发过程拆分成多个小周期，即一次”大开发”变成多次”小开发”，每次小开发都是同样的流程，所以看上去就好像重复在做同样的步骤。</p>
<p><img src="https://www.wangbase.com/blogimg/asset/201903/bg2019030702.jpg" alt="img"></p>
<p>举例来说，SpaceX 公司想造一个大推力火箭，将人类送到火星。但是，它不是一开始就造大火箭，而是先造一个最简陋的小火箭 Falcon 1。结果，第一次发射就爆炸了，直到第四次发射，才成功进入轨道。然后，开发了中型火箭 Falcon 9，九年中发射了70次。最后，才开发 Falcon 重型火箭。如果 SpaceX 不采用迭代开发，它可能直到现在还无法上天。</p>
<p><strong>迭代开发将一个大任务，分解成多次连续的开发，本质就是逐步改进。</strong>开发者先快速发布一个有效但不完美的最简版本，然后不断迭代。每一次迭代都包含规划、设计、编码、测试、评估五个步骤，不断改进产品，添加新功能。通过频繁的发布，以及跟踪对前一次迭代的反馈，最终接近较完善的产品形态。</p>
<h4 id="增量开发"><a href="#增量开发" class="headerlink" title="增量开发"></a>增量开发</h4><p>迭代开发只是要求将开发分成多个迭代，并没有回答一个重要的问题：怎么划分迭代，哪个任务在这个迭代，哪个任务在下个迭代？这时，一般采用”增量开发”（incremental development）划分迭代。</p>
<p><strong>所谓”增量开发”，指的是软件的每个版本，都会新增一个用户可以感知的完整功能。也就是说，按照新增功能来划分迭代。</strong></p>
<p><img src="https://www.wangbase.com/blogimg/asset/201903/bg2019030703.jpg" alt="img"></p>
<p>举例来说，房产公司开发一个10栋楼的小区。如果采用增量开发的模式，该公司第一个迭代就是交付一号楼，第二个迭代交付二号楼……每个迭代都是完成一栋完整的楼。而不是第一个迭代挖好10栋楼的地基，第二个迭代建好每栋楼的骨架，第三个迭代架设屋顶……</p>
<p><strong>增量开发加上迭代开发，才算真正的敏捷开发。</strong></p>
<h4 id="敏捷开发的好处"><a href="#敏捷开发的好处" class="headerlink" title="敏捷开发的好处"></a>敏捷开发的好处</h4><h3 id="3-1-早期交付"><a href="#3-1-早期交付" class="headerlink" title="3.1 早期交付"></a>3.1 早期交付</h3><p><strong>敏捷开发的第一个好处，就是早期交付，从而大大降低成本。</strong></p>
<p>还是以上一节的房产公司为例，如果按照传统的”瀑布开发模式”，先挖10栋楼的地基、再盖骨架、然后架设屋顶，每个阶段都等到前一个阶段完成后开始，可能需要两年才能一次性交付10栋楼。也就是说，如果不考虑预售，该项目必须等到两年后才能回款。</p>
<p>敏捷开发是六个月后交付一号楼，后面每两个月交付一栋楼。因此，半年就能回款10%，后面每个月都会有现金流，资金压力就大大减轻了。</p>
<h3 id="3-2-降低风险"><a href="#3-2-降低风险" class="headerlink" title="3.2 降低风险"></a>3.2 降低风险</h3><p><strong>敏捷开发的第二个好处是，及时了解市场需求，降低产品不适用的风险。</strong></p>
<p>请想一想，哪一种情况损失比较小：10栋楼都造好以后，才发现卖不出去，还是造好第一栋楼，就发现卖不出去，从而改进或停建后面9栋楼？</p>
<p>对于软件项目来说，先有一个原型产品，了解市场的接受程度，往往是项目成功的关键。有一本书叫做《梦断代码》，副标题就是”20+个程序员，三年时间，4732个bug，100+万美元，最后失败的故事”，这就是没有采用敏捷开发的结果。相反的，Instagram 最初是一个地理位置打卡 App，后来发现用户不怎么在乎地理位置，更喜欢上传照片，就改做照片上传软件，结果成了独角兽。</p>
<p>由于敏捷开发可以不断试错，找出对业务最重要的功能，然后通过迭代，调整软件方向。相比传统方式，大大增加了产品成功的可能性。如果市场需求不确定，或者你对该领域不熟悉，那么敏捷开发几乎是唯一可行的应对方式。</p>
<h2 id="如何进行每一次迭代"><a href="#如何进行每一次迭代" class="headerlink" title="如何进行每一次迭代"></a>如何进行每一次迭代</h2><p>虽然敏捷开发将软件开发分成多个迭代，但是也要求，<strong>每次迭代都是一个完整的软件开发周期，必须按照软件工程的方法论，进行正规的流程管理。</strong></p>
<p><img src="https://www.wangbase.com/blogimg/asset/201903/bg2019030704.jpg" alt="img"></p>
<p>具体来说，每次迭代都必须依次完成以下五个步骤。</p>
<blockquote>
<ol>
<li>需求分析（requirements analysis）</li>
<li>设计（design）</li>
<li>编码（coding）</li>
<li>测试（testing）</li>
<li>部署和评估（deployment / evaluation）</li>
</ol>
</blockquote>
<p>每个迭代大约持续2~6周。</p>
<h2 id="敏捷开发的价值观"><a href="#敏捷开发的价值观" class="headerlink" title="敏捷开发的价值观"></a>敏捷开发的价值观</h2><p>《敏捷软件开发宣言》里面提到四个价值观。</p>
<blockquote>
<ul>
<li>程序员的主观能动性，以及程序员之间的互动，优于既定流程和工具。</li>
<li>软件能够运行，优于详尽的文档。</li>
<li>跟客户的密切协作，优于合同和谈判。</li>
<li>能够响应变化，优于遵循计划。</li>
</ul>
</blockquote>
<h2 id="十二条原则"><a href="#十二条原则" class="headerlink" title="十二条原则"></a>十二条原则</h2><p>该宣言还提出十二条敏捷开发的原则。</p>
<ol>
<li>通过早期和持续交付有价值的软件，实现客户满意度。</li>
<li>欢迎不断变化的需求，即使是在项目开发的后期。要善于利用需求变更，帮助客户获得竞争优势。</li>
<li>不断交付可用的软件，周期通常是几周，越短越好。</li>
<li>项目过程中，业务人员与开发人员必须在一起工作。</li>
<li>项目必须围绕那些有内在动力的个人而建立，他们应该受到信任。</li>
<li>面对面交谈是最好的沟通方式。</li>
<li>可用性是衡量进度的主要指标。</li>
<li>提倡可持续的开发，保持稳定的进展速度。</li>
<li>不断关注技术是否优秀，设计是否良好。</li>
<li>简单性至关重要，尽最大可能减少不必要的工作。</li>
<li>最好的架构、要求和设计，来自团队内部自发的认识。</li>
<li>团队要定期反思如何更有效，并相应地进行调整。</li>
</ol>
<h2 id="参考链接"><a href="#参考链接" class="headerlink" title="参考链接"></a>参考链接</h2><ul>
<li><a target="_blank" rel="noopener" href="https://www.mindk.com/blog/iterative-development/">Iterative development: the secret to great product launches</a>, Pavlo Zinchenko</li>
<li><a target="_blank" rel="noopener" href="https://en.wikipedia.org/wiki/Agile_software_development">Agile software development</a>, Wikipedia</li>
</ul>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://wrr123.github.io/2020/07/07/git%E8%BF%9C%E7%A8%8B%E5%88%86%E6%94%AF%E5%88%9B%E5%BB%BA/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="田园隐士">
      <meta itemprop="description" content="talk is cheap, show me the code">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="一缕烟气">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2020/07/07/git%E8%BF%9C%E7%A8%8B%E5%88%86%E6%94%AF%E5%88%9B%E5%BB%BA/" class="post-title-link" itemprop="url">git远程分支创建</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2020-07-07 21:44:53" itemprop="dateCreated datePublished" datetime="2020-07-07T21:44:53+08:00">2020-07-07</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2022-02-18 10:52:04" itemprop="dateModified" datetime="2022-02-18T10:52:04+08:00">2022-02-18</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E7%89%88%E6%9C%AC%E7%AE%A1%E7%90%86%E5%B7%A5%E5%85%B7/" itemprop="url" rel="index"><span itemprop="name">版本管理工具</span></a>
                </span>
            </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>781</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>1 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h4 id="新建远程分支"><a href="#新建远程分支" class="headerlink" title="新建远程分支"></a>新建远程分支</h4><ul>
<li><p>新建一个本地分支dev,并切换到dev分支</p>
  <figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">假设在master分支</span></span><br><span class="line">git checkout -b dev</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">或</span></span><br><span class="line">git branch dev</span><br><span class="line">git checkout dev</span><br></pre></td></tr></table></figure>
</li>
<li><p>将本地分支dev推送到远程服务器，远程分支和本地分支同名（也是可以不同名的）</p>
  <figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">git push origin dev:dev</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">第一个dev是本地分支名，第二个dev是远程分支名</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>将本地分支dev和远程分支origin/dev之间建立追踪关系</p>
  <figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">git checkout dev</span><br><span class="line">git branch -u origin/dev</span><br></pre></td></tr></table></figure>
</li>
<li><p>将本地分支和远程分支的映射关系取消</p>
  <figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">git checkout dev <span class="comment"># 先切换到需要取消映射的本地分支</span></span><br><span class="line">git branch --unset-upstream</span><br></pre></td></tr></table></figure>
</li>
</ul>
<h4 id="删除远程分支"><a href="#删除远程分支" class="headerlink" title="删除远程分支"></a>删除远程分支</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">git checkout dev</span><br><span class="line">git push origin :dev #origin后面不添加分支名，即可删除远程分支</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">或</span></span><br><span class="line">git push origin --delete dev</span><br></pre></td></tr></table></figure>
<h5 id="查看本地分支和远程分支的映射关系"><a href="#查看本地分支和远程分支的映射关系" class="headerlink" title="查看本地分支和远程分支的映射关系"></a>查看本地分支和远程分支的映射关系</h5><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git branch -vv	</span><br></pre></td></tr></table></figure>
<h4 id="将远程git仓库里的指定分支拉取到本地（本地不存在的分支）"><a href="#将远程git仓库里的指定分支拉取到本地（本地不存在的分支）" class="headerlink" title="将远程git仓库里的指定分支拉取到本地（本地不存在的分支）"></a>将远程git仓库里的指定分支拉取到本地（本地不存在的分支）</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">git fetch origin 远程分支名x:本地分支名x</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">使用该方式会在本地新建分支x，但是不会自动切换到该本地分支x，需要手动checkout。</span></span><br></pre></td></tr></table></figure>
<blockquote>
<p>采用此种方法建立的本地分支不会和远程分支建立映射关系。</p>
</blockquote>
<h4 id="分支origin-HEAD的作用"><a href="#分支origin-HEAD的作用" class="headerlink" title="分支origin/HEAD的作用"></a>分支origin/HEAD的作用</h4><figure class="highlight text"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">remotes/origin/HEAD -&gt; origin/master</span><br><span class="line">remotes/origin/dev</span><br></pre></td></tr></table></figure>
<p>origin/HEAD就像一个指针，表示默认分支，如上面的例子就是指向<code>origin/master</code>,即<code>origin/master</code>是默认分支。</p>
<blockquote>
<p>删掉也是可以的：$ git remote set-head origin -d 这样就移除了 origin/HEAD -&gt; origin/master 这一行。</p>
</blockquote>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://wrr123.github.io/2020/07/07/ajax%E4%BC%A0%E9%80%92%E6%95%B0%E7%BB%84%E5%BD%A2%E5%BC%8F%E7%9A%84%E5%8F%82%E6%95%B0/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="田园隐士">
      <meta itemprop="description" content="talk is cheap, show me the code">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="一缕烟气">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2020/07/07/ajax%E4%BC%A0%E9%80%92%E6%95%B0%E7%BB%84%E5%BD%A2%E5%BC%8F%E7%9A%84%E5%8F%82%E6%95%B0/" class="post-title-link" itemprop="url">ajax传递数组形式的参数</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2020-07-07 16:32:20" itemprop="dateCreated datePublished" datetime="2020-07-07T16:32:20+08:00">2020-07-07</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2022-02-18 10:52:04" itemprop="dateModified" datetime="2022-02-18T10:52:04+08:00">2022-02-18</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E5%89%8D%E7%AB%AF/" itemprop="url" rel="index"><span itemprop="name">前端</span></a>
                </span>
            </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>1.2k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>1 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h4 id="两种方案"><a href="#两种方案" class="headerlink" title="两种方案"></a>两种方案</h4><h5 id="加入traditional防止深度序列化"><a href="#加入traditional防止深度序列化" class="headerlink" title="加入traditional防止深度序列化"></a>加入<code>traditional</code>防止深度序列化</h5><p>前端代码</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">$.<span class="title function_">ajax</span>(&#123;</span><br><span class="line">    <span class="attr">url</span>:<span class="string">&quot;*****&quot;</span>,</span><br><span class="line">    <span class="attr">data</span>:&#123;</span><br><span class="line">        <span class="string">&quot;userid&quot;</span>:userid,</span><br><span class="line">        <span class="string">&quot;username&quot;</span>:username,</span><br><span class="line">        <span class="string">&quot;school&quot;</span>:school</span><br><span class="line">    &#125;,</span><br><span class="line">    <span class="attr">dataType</span>:<span class="string">&quot;json&quot;</span>,</span><br><span class="line">    <span class="attr">type</span>:<span class="string">&quot;post&quot;</span>,</span><br><span class="line">    <span class="attr">traditional</span>:<span class="literal">true</span>,<span class="comment">//防止深度序列化</span></span><br><span class="line">    <span class="attr">cache</span>:<span class="literal">false</span>,</span><br><span class="line">    <span class="attr">async</span>:<span class="literal">false</span>,</span><br><span class="line">    <span class="attr">success</span>:<span class="keyword">function</span>(<span class="params"></span>)&#123;</span><br><span class="line">        ....</span><br><span class="line">    &#125;</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>
<p>后端代码</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@requesMapping(value=&quot;/****&quot;, method=RequestMethod.POST)</span></span><br><span class="line"><span class="meta">@responseBody</span></span><br><span class="line"><span class="keyword">public</span> String <span class="title function_">testForAjax</span><span class="params">(<span class="meta">@RequestParam(value=&quot;userid&quot;)</span> Integer[] userid, <span class="meta">@RequestParam(value=&quot;username&quot;)</span> String[] username, String school)</span>&#123;</span><br><span class="line">  </span><br><span class="line">      .....</span><br><span class="line"> </span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h5 id="指定参数类型"><a href="#指定参数类型" class="headerlink" title="指定参数类型"></a>指定参数类型</h5><p>前端代码</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">$.<span class="title function_">ajax</span>(&#123;</span><br><span class="line">    <span class="attr">url</span>:<span class="string">&quot;*****&quot;</span>,</span><br><span class="line">    <span class="attr">data</span>:&#123;</span><br><span class="line">        <span class="string">&quot;userid&quot;</span>:userid,</span><br><span class="line">        <span class="string">&quot;username&quot;</span>:username,</span><br><span class="line">        <span class="string">&quot;school&quot;</span>:school</span><br><span class="line">    &#125;,</span><br><span class="line">    <span class="attr">dataType</span>:<span class="string">&quot;json&quot;</span>,</span><br><span class="line">    <span class="attr">type</span>:<span class="string">&quot;post&quot;</span>,</span><br><span class="line">    <span class="attr">cache</span>:<span class="literal">false</span>,</span><br><span class="line">    <span class="attr">async</span>:<span class="literal">false</span>,</span><br><span class="line">    <span class="attr">success</span>:<span class="keyword">function</span>(<span class="params"></span>)&#123;</span><br><span class="line">        ....</span><br><span class="line">    &#125;</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>
<p>后端代码</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@requesMapping(value=&quot;/****&quot;, method=RequestMethod.POST)</span></span><br><span class="line"><span class="meta">@responseBody</span></span><br><span class="line"><span class="keyword">public</span> String <span class="title function_">testForAjax</span><span class="params">(<span class="meta">@RequestParam(value=&quot;userid[]&quot;)</span> Integer[] userid, <span class="meta">@RequestParam(value=&quot;username[]&quot;)</span> String[] username, String school)</span>&#123;</span><br><span class="line"> </span><br><span class="line">    .....</span><br><span class="line"> </span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h4 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h4><p>若前端传递的参数类型为数组的话，在后端(如java)进行接收的话， <strong>不能使用Map类型的参数来接受</strong>，否则只能接受到数组的第一个参数值。</p>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://wrr123.github.io/2020/07/07/faq-git/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="田园隐士">
      <meta itemprop="description" content="talk is cheap, show me the code">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="一缕烟气">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2020/07/07/faq-git/" class="post-title-link" itemprop="url">faq-git</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2020-07-07 13:25:25" itemprop="dateCreated datePublished" datetime="2020-07-07T13:25:25+08:00">2020-07-07</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2022-02-18 10:52:04" itemprop="dateModified" datetime="2022-02-18T10:52:04+08:00">2022-02-18</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E7%89%88%E6%9C%AC%E5%B7%A5%E5%85%B7/" itemprop="url" rel="index"><span itemprop="name">版本工具</span></a>
                </span>
            </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>309</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>1 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h4 id="解决git中文路径显示unicode代码的问题"><a href="#解决git中文路径显示unicode代码的问题" class="headerlink" title="解决git中文路径显示unicode代码的问题"></a>解决git中文路径显示unicode代码的问题</h4><p><code>git config --global core.quotepath false</code></p>
<p>添加上述配置，git就不会对路径进行转换，会显示完整的中文路径名称。</p>
<h4 id="remote-HTTP-Basic-Access-denied"><a href="#remote-HTTP-Basic-Access-denied" class="headerlink" title="remote: HTTP Basic: Access denied"></a>remote: HTTP Basic: Access denied</h4><p>问题描述：</p>
<p><img src="http://localhost:4000/2020/07/07/faq-git/001.png" alt></p>
<p>解决方案：</p>
<p>进入本地仓库目录下，执行如下命令：</p>
<p><code>git config --system --unset credential.helper</code></p>
<p>重新操作 git， 再次输入账号和密码即可。</p>
<p>因上述命令会清空 git config 里面保存的用户名和密码配置，在第一次清空之后，可以执行命令</p>
<p><code>git config --system credential.helper store</code></p>
<p>来保存用户名和密码配置信息。</p>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://wrr123.github.io/2020/07/07/js%E4%B8%AD%E6%95%B0%E7%BB%84%E5%B8%B8%E7%94%A8%E6%96%B9%E6%B3%95%E6%80%BB%E7%BB%93/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="田园隐士">
      <meta itemprop="description" content="talk is cheap, show me the code">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="一缕烟气">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2020/07/07/js%E4%B8%AD%E6%95%B0%E7%BB%84%E5%B8%B8%E7%94%A8%E6%96%B9%E6%B3%95%E6%80%BB%E7%BB%93/" class="post-title-link" itemprop="url">js中数组常用方法总结</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2020-07-07 11:03:11" itemprop="dateCreated datePublished" datetime="2020-07-07T11:03:11+08:00">2020-07-07</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2022-02-18 10:52:04" itemprop="dateModified" datetime="2022-02-18T10:52:04+08:00">2022-02-18</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E5%89%8D%E7%AB%AF/" itemprop="url" rel="index"><span itemprop="name">前端</span></a>
                </span>
            </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>108</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>1 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h4 id="掘金文档参考"><a href="#掘金文档参考" class="headerlink" title="掘金文档参考"></a><a target="_blank" rel="noopener" href="https://juejin.im/post/5aab704ef265da239a5f8f52">掘金文档参考</a></h4><h4 id="map"><a href="#map" class="headerlink" title="map()"></a>map()</h4><p><img src="http://localhost:4000/2020/07/07/js%E4%B8%AD%E6%95%B0%E7%BB%84%E5%B8%B8%E7%94%A8%E6%96%B9%E6%B3%95%E6%80%BB%E7%BB%93/22.png" alt></p>
<h4 id="every"><a href="#every" class="headerlink" title="every()"></a>every()</h4><p><img src="http://localhost:4000/2020/07/07/js%E4%B8%AD%E6%95%B0%E7%BB%84%E5%B8%B8%E7%94%A8%E6%96%B9%E6%B3%95%E6%80%BB%E7%BB%93/11.png" alt></p>
<h4 id="some"><a href="#some" class="headerlink" title="some()"></a>some()</h4><p><img src="http://localhost:4000/2020/07/07/js%E4%B8%AD%E6%95%B0%E7%BB%84%E5%B8%B8%E7%94%A8%E6%96%B9%E6%B3%95%E6%80%BB%E7%BB%93/33.png" alt></p>
<h4 id="filter"><a href="#filter" class="headerlink" title="filter()"></a>filter()</h4><p><img src="http://localhost:4000/2020/07/07/js%E4%B8%AD%E6%95%B0%E7%BB%84%E5%B8%B8%E7%94%A8%E6%96%B9%E6%B3%95%E6%80%BB%E7%BB%93/44.png" alt></p>
<h4 id="sort"><a href="#sort" class="headerlink" title="sort()"></a>sort()</h4><p><img src="http://localhost:4000/2020/07/07/js%E4%B8%AD%E6%95%B0%E7%BB%84%E5%B8%B8%E7%94%A8%E6%96%B9%E6%B3%95%E6%80%BB%E7%BB%93/55.png" alt></p>
<h4 id="forEach"><a href="#forEach" class="headerlink" title="forEach()"></a>forEach()</h4><p><img src="http://localhost:4000/2020/07/07/js%E4%B8%AD%E6%95%B0%E7%BB%84%E5%B8%B8%E7%94%A8%E6%96%B9%E6%B3%95%E6%80%BB%E7%BB%93/66.png" alt></p>
<h4 id="concat"><a href="#concat" class="headerlink" title="concat()"></a>concat()</h4><p>concat() 方法用于连接两个或者多个数组。</p>
<p>该方法不会改变现有的数组，而仅仅会返回被连接数组的一个副本。</p>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://wrr123.github.io/2020/07/06/easypoi-excel%E6%A8%A1%E6%9D%BF%E5%A4%84%E7%90%86/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="田园隐士">
      <meta itemprop="description" content="talk is cheap, show me the code">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="一缕烟气">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2020/07/06/easypoi-excel%E6%A8%A1%E6%9D%BF%E5%A4%84%E7%90%86/" class="post-title-link" itemprop="url">easypoi-excel模板处理</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2020-07-06 11:14:28" itemprop="dateCreated datePublished" datetime="2020-07-06T11:14:28+08:00">2020-07-06</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2022-02-18 10:52:04" itemprop="dateModified" datetime="2022-02-18T10:52:04+08:00">2022-02-18</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/java/" itemprop="url" rel="index"><span itemprop="name">java</span></a>
                </span>
            </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>744</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>1 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h4 id="模板指令介绍"><a href="#模板指令介绍" class="headerlink" title="模板指令介绍"></a>模板指令介绍</h4><figure class="highlight text"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">&gt; 下面列举下EasyPoi支持的指令以及作用，**最主要的就是各种fe的用法**</span><br><span class="line">&gt;</span><br><span class="line">&gt; - 空格分割</span><br><span class="line">&gt; - 三目运算 &#123;&#123;test ? obj:obj2&#125;&#125;</span><br><span class="line">&gt; - n: 表示 这个cell是数值类型 &#123;&#123;n:&#125;&#125;</span><br><span class="line">&gt; - le: 代表长度&#123;&#123;le:()&#125;&#125; 在if/else 运用&#123;&#123;le:() &gt; 8 ? obj1 : obj2&#125;&#125;</span><br><span class="line">&gt; - fd: 格式化时间 &#123;&#123;fd:(obj;yyyy-MM-dd)&#125;&#125;</span><br><span class="line">&gt; - fn: 格式化数字 &#123;&#123;fn:(obj;###.00)&#125;&#125;</span><br><span class="line">&gt; - fe: 遍历数据,创建row</span><br><span class="line">&gt; - !fe: 遍历数据不创建row</span><br><span class="line">&gt; - $fe: 下移插入,把当前行,下面的行全部下移.size()行,然后插入</span><br><span class="line">&gt; - \#fe: 横向遍历</span><br><span class="line">&gt; - v_fe: 横向遍历值</span><br><span class="line">&gt; - !if: 删除当前列 &#123;&#123;!if:(test)&#125;&#125;</span><br><span class="line">&gt; - 单引号表示常量值 &#x27;&#x27; 比如&#x27;1&#x27; 那么输出的就是 1</span><br><span class="line">&gt; - &amp;NULL&amp; 空格</span><br><span class="line">&gt; - ]] 换行符 多行遍历导出</span><br><span class="line">&gt; - sum： 统计数据</span><br></pre></td></tr></table></figure>
<h4 id="基本导出"><a href="#基本导出" class="headerlink" title="基本导出"></a>基本导出</h4><p>是插入数据的，不是单纯的导出一个标题和表头。</p>
<p><img src="http://localhost:4000/2020/07/06/easypoi-excel%E6%A8%A1%E6%9D%BF%E5%A4%84%E7%90%86/11.png" alt></p>
<h4 id="单纯的导出excel文件的表头信息"><a href="#单纯的导出excel文件的表头信息" class="headerlink" title="单纯的导出excel文件的表头信息"></a>单纯的导出excel文件的表头信息</h4><p>使用注解@Excel,在实体类上使用</p>
<p>设置导出参数类，<code>ExportParams</code></p>
<p>使用导出工具类实现导出，<code>ExcelExportUtil</code></p>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://wrr123.github.io/2020/07/06/faq-vuejs/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="田园隐士">
      <meta itemprop="description" content="talk is cheap, show me the code">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="一缕烟气">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2020/07/06/faq-vuejs/" class="post-title-link" itemprop="url">faq-vuejs</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2020-07-06 10:12:21" itemprop="dateCreated datePublished" datetime="2020-07-06T10:12:21+08:00">2020-07-06</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2022-02-18 10:52:04" itemprop="dateModified" datetime="2022-02-18T10:52:04+08:00">2022-02-18</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E5%89%8D%E7%AB%AF/" itemprop="url" rel="index"><span itemprop="name">前端</span></a>
                </span>
            </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>3.5k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>3 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h4 id="vue-Element-UI-日期选择器获取日期格式问题-t-getTime-is-not-a-function"><a href="#vue-Element-UI-日期选择器获取日期格式问题-t-getTime-is-not-a-function" class="headerlink" title="vue Element UI 日期选择器获取日期格式问题 t.getTime is not a function"></a>vue Element UI 日期选择器获取日期格式问题 t.getTime is not a function</h4><p><a target="_blank" rel="noopener" href="https://my.oschina.net/u/4298485/blog/3937219">oschina参考文档</a></p>
<h4 id="vuejs-不支持-ie-浏览器的问题"><a href="#vuejs-不支持-ie-浏览器的问题" class="headerlink" title="vuejs 不支持 ie 浏览器的问题"></a>vuejs 不支持 ie 浏览器的问题</h4><h5 id="可能原因-一"><a href="#可能原因-一" class="headerlink" title="可能原因(一)"></a>可能原因(一)</h5><p>因为 Vue 使用了 ES6 Promise，而 IE 浏览器不支持。</p>
<p><strong>解决方法：</strong></p>
<p>使用 babel-polyfill 转换</p>
<p><code>npm install [--save-dev] babel-polyfill</code></p>
<p>如果使用 vue-cli 项目，在 webpack.config.js 中添加：</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">require</span>(<span class="string">&#x27;babel-polyfill&#x27;</span>)</span><br><span class="line"></span><br><span class="line"><span class="attr">entry</span>: &#123;</span><br><span class="line">    <span class="attr">app</span>: [<span class="string">&#x27;babel-polyfill&#x27;</span>, <span class="string">&#x27;./src/main.js&#x27;</span>]</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
          <!--noindex-->
            <div class="post-button">
              <a class="btn" href="/2020/07/06/faq-vuejs/#more" rel="contents">
                阅读全文 &raquo;
              </a>
            </div>
          <!--/noindex-->
        
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  


  
  <nav class="pagination">
    <a class="extend prev" rel="prev" href="/page/32/"><i class="fa fa-angle-left" aria-label="上一页"></i></a><a class="page-number" href="/">1</a><span class="space">&hellip;</span><a class="page-number" href="/page/32/">32</a><span class="page-number current">33</span><a class="page-number" href="/page/34/">34</a><a class="page-number" href="/page/35/">35</a><a class="extend next" rel="next" href="/page/34/"><i class="fa fa-angle-right" aria-label="下一页"></i></a>
  </nav>



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">田园隐士</p>
  <div class="site-description" itemprop="description">talk is cheap, show me the code</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">347</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
        <span class="site-state-item-count">53</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
        <span class="site-state-item-count">115</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">田园隐士</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-area"></i>
    </span>
    <span title="站点总字数">587k</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="站点阅读时长">8:53</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://muse.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Muse</a> 强力驱动
  </div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/muse.js"></script>


<script src="/js/next-boot.js"></script>




  




  
<script src="/js/local-search.js"></script>













  

  

  

</body>
</html>
